﻿@model ProductsByTagModel
@inject SeoSettings seoSettings
@inject IPageHeadBuilder pagebuilder
@{
    Layout = "_TwoColumns";

    //title
    pagebuilder.AddTitleParts(string.Format(Loc["Title.ProductsByTag"], Model.TagName));

    //canonical URL
    var canonicalUrlsEnabled = seoSettings.CanonicalUrlsEnabled;
    if (canonicalUrlsEnabled)
    {
        var productsByTagUrl = Url.RouteUrl("ProductsByTag", new { productTagId = Model.Id, SeName = Model.TagSeName }, Url.ActionContext.HttpContext.Request.Scheme);
        pagebuilder.AddCanonicalUrlParts(productsByTagUrl);
    }
}
<div class="page product-tag-page">
    <h1 class="generalTitle h2">@string.Format(Loc["Products.Tags.ProductsTaggedWith"], Model.TagName)</h1>
    @await Component.InvokeAsync("Widget", new { widgetZone = "productsbytag_top", additionalData = Model.Id })
    <div id="catalog-products">
        <partial name="Partials/Selectors"/>
        <template v-if="catalog.Model.Products.length > 0">
            <template v-if="catalog.Model.PagingFilteringContext.ViewMode == 'grid'">
                <div class="col-12 product-grid px-0">
                    <div class="form-row">
                        <template v-for="Model in catalog.Model.Products">
                            <div class="col-lg-4 col-sm-6 col-6 product-container mb-2">
                                <partial name="Partials/CatalogProductGridView"/>
                            </div>
                        </template>
                    </div>
                </div>
            </template>
            <template v-else>
                <div class="product-list">
                    <div class="col-12">
                        <div class="row">
                            <template v-for="Model in catalog.Model.Products">
                                <partial name="Partials/CatalogProductListView"/>
                            </template>
                        </div>
                    </div>
                </div>
            </template>
            <partial name="Partials/Pagination"/>
        </template>
        <template v-else>
            <div class="alert alert-info my-3">
                @Loc["search.noresultstext"]
            </div>
        </template>
    </div>
</div>
@await Component.InvokeAsync("Widget", new { widgetZone = "productsbytag_bottom", additionalData = Model.Id })

<partial name="Partials/ModelScript" model="@Json.Serialize(Model)"/>